<?php

/**
 * This is the model class for table "{{widget}}".
 *
 * The followings are the available columns in table '{{widget}}':
 * @property integer $id
 * @property string $title
 * @property integer $status
 * @property string $image
 * @property string $link
 * @property string $description
 */
class SlideItem extends CModel {

    public $id;
    public $title;
    public $status;
    public $image;
    public $link;
    public $description;

    /**
     * Returns the static model of the specified AR class.
     * @param string $className active record class name.
     * @return Widget the static model class
     */
    public static function model($className = __CLASS__) {
	return new SlideItem;
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
	// NOTE: you should only define rules for those attributes that
	// will receive user inputs.
	return array(
	    array('title, image, status', 'required'),
	    array('status', 'numerical', 'integerOnly' => true),
	    //array('image', 'file', 'allowEmpty' => true, 'types' => 'jpg,jpeg,gif,png'),
	    //array('link', 'url', 'allowEmpty' => true),
	    array('description', 'length', 'max' => 310),
	    array('title', 'length', 'max' => 50),
	    array('link', 'length', 'max' => 255),
	    // The following rule is used by search().
	    // Please remove those attributes that should not be searched.
	    array('title, status, image, link, description', 'safe', 'on' => 'search'),
	);
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
	return array(
	    'id' => t('LBL_ID', 'widget'),
	    'title' => t('LBL_TITLE', 'widget'),
	    'status' => t('LBL_STATUS', 'widget'),
	    'image' => t('LBL_IMAGE', 'widget'),
	    'link' => t('LBL_LINK', 'widget'),
	    'description' => t('LBL_DESCRIPTION', 'widget'),
	);
    }

    public function attributeNames() {
	return array('id', 'title', 'status', 'image', 'link', 'description');
    }
}